#include "TestUtils.h"
#include <float.h>
#include <cmath>
#include <algorithm>

using namespace std;

int compare(float x1, float x2, float eps) {
    float m1 = abs(x1);
    float m2 = abs(x2);		
    float module = max(1.0f, max(m1, m2));
    if (abs(x1 - x2) < module * eps) return 0;
    if (x1 < x2) return -1;
    return 1;
}

int compare(const float *v1, const float *v2, size_t count, float eps) {
    for (size_t i = 0; i < count; i++) {
        int result = compare(v1[i], v2[i], eps);
        if (result != 0) return result;
    }
    return 0;
}